<?php
//пароль
define("INWEB",true);
require('include/config.php');

loggedInOrReturn('index.php');
head('Index',isset($_GET['no_head'])?0:1);
$user->setVar('lastAccess',time());
$page=isset($_GET['p'])?$_GET['p']:'';
if($page!='' && $page!='chnglng' && !checkAccess($menu,$page))
{
    msg($Lang['error'], $Lang['no_access'], 'error');
}
else
{
    switch($page)
    {
        case 'access':
            require('module/access.php');
        break;
        case 'users':
            require('module/users.php');
        break;
        case 'brok':
            require('module/brokers.php');
        break;
        case 'creasons':
            require('module/creasons.php');
        break;
        case 'currency':
            require('module/currency.php');
        break;
        case 'ins_comps':
            require('module/ins_comps.php');
        break;
        case 'ins_type':
            require('module/ins_type.php');
        break;
        case 'obj_type':
            require('module/obj_type.php');
        break;
        case 'val_ter':
            require('module/val_ter.php');
        break;
        case 'pol_status':
            require('module/pol_status.php');
        break;
        case 'manu':
            require('module/manu.php');
        break;
        case 'octa_codes':
            require('module/octa_codes.php');
        break;
        case 'octa_examples':
            require('module/octa_examples.php');
        break;
        case 'octa_discounts':
            require('module/octa_discounts.php');
        break;
        case 'prof':
            require('module/prof.php');
        break;
        case 'config':
            require('module/config.php');
        break;
        case 'menu':
            require('module/menu.php');
        break;
        case 'obj':
            require('module/objects.php');
        break;
        case 'pol':
            require('module/policies.php');
        break;
        case 'cli':
            require('module/clients.php');
        break;
        case 'chat':
            require('module/chat.php');
        break;
        case 'payments':
                require('module/payments.php');
        break;
        case 'per':
                require('module/rep_period.php');
        break;
        case 'fin':
                require('module/rep_finance.php');
        break;
        case 'chnglng':
            $lng=getVar('lang');
            if(!is_lang($lng))
            {
                msg($Lang['error'], $Lang['incorrect_lang'], 'error');
                break;   
            }
            if($user->logged())
                $user->setVar('lang',$lng);
            else
                setcookie('lang', $lng);
            includeLang('theme');
            msg($Lang['success'],$Lang['lang_changed']);
        break;
        default:
            if(getConfig('settings','chat_enabled','0'))
            {
                includeLang('chat');
                if($user->getVar('show_chat'))
                {
                    $parse=$Lang;
                    $parse['host']=$host;
                    $parse['chat_clear'] = ( $user->hasAccess('chat_delete_all') ? "<a href='index.php?p=chat&no_head&delall' onclick=\"confirm_delete(); return false;\"><img src='img/delete.png' border='0' alt=\"{$Lang['empty_chat']}\" title=\"{$Lang['empty_chat']}\" /></a> " : "" );
                    $tpl->parsetemplate('chat',$parse);
                }
                else
                {
                    echo '<div style="text-align:left;width:100%;border:1px solid black;padding:5px;"><div style="background:transparent;height:25px;"><b>'.$Lang['chat'].' </b>[ <a href="'.$host.'/index.php?p=chat&enable=1"><b>'.$Lang['chat_open'].' ]</b></a></div></div><br />';
                }
            }
        break;
    }
}
foot(isset($_GET['no_head'])?0:1);
?>